package czy.demo.config.jpa;

import czy.demo.entity.BaseEntity;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;


/* JPA配置，实体包，仓库包
 * @EntityScan：指定实体扫描的包
 * @EnableJpaRepositories：指定仓库扫描的包
 * @EnableJpaAuditing：开启审计功能
 * 审计功能由注解实现：@CreatedBy、@CreatedDate、@LastModifiedBy、@Version
 */
@Configuration
@EntityScan(basePackageClasses = BaseEntity.class)
@EnableJpaRepositories(basePackages = "czy.demo.repository")
@EnableJpaAuditing(auditorAwareRef="auditorAware",setDates = true,modifyOnCreate = true )
public class SpringJPAConfig {

}
